<template>
  <div class="banner">
    <div class="banner-img-wrapper" @click="handleGallaryClick">
      <img class="banner-img" :src="bannerImg">
      <div class="banner-info">
        <div class="banner-title">{{sightName}}</div>
        <div class="banner-number">
          <span class="iconfont icon-img">&#xe606;</span>
          {{gallaryImgs.length}}
        </div>
      </div>
    </div>
    <fade-animation>
      <common-gallary
        :imgs="gallaryImgs"
        v-show="showGallary"
        @close="handleCloseClick"
      ></common-gallary>
    </fade-animation>
  </div>
</template>
<script>
import CommonGallary from 'common/gallary/Gallary'
import FadeAnimation from 'common/animation/FadeAnimation'
export default {
  name: 'DetailBanner',
  props: {
    sightName: String,
    bannerImg: String,
    gallaryImgs: Array
  },
  data () {
    return {
      imgs: [],
      showGallary: false
    }
  },
  methods: {
    handleGallaryClick () {
      this.showGallary = true
    },
    handleCloseClick () {
      this.showGallary = false
    }
  },
  components: {
    CommonGallary,
    FadeAnimation
  }
}
</script>
<style lang="stylus" scoped>
  .banner
    .banner-img-wrapper
      position relative
      overflow hidden
      width 100%
      height 0
      padding-bottom 55%
      .banner-img
        width 100%
      .banner-info
        display flex
        position absolute
        left 0
        right 0
        bottom 0
        color #ffffff
        background-image linear-gradient(top,rgba(0,0,0,0),rgba(0,0,0,.7))
        .banner-title
          flex 1
          line-height .6rem
          font-size .32rem
          padding 0 .2rem
        .banner-number
          height  .4rem
          line-height .4rem
          padding 0 .36rem
          margin-top .1rem
          border-radius .2rem
          background-color rgba(0,0,0,0.6)
          font-size .24rem
          box-sizing border-box
          .icon-img
            font-size .24rem
</style>
